package view;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;

import javafx.scene.image.Image;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import model.Recommendation;

/**
 * This class allows a reccommendation to be viewed.
 * 
 * @author Greg Coleman, Cody Thompson
 * @author Rylie Nelson
 *
 */
public class ViewRec extends JFrame {

	private JButton btnConfirm;

	private JTextArea texty;

	private JSlider miniBurger;


	public ViewRec(Recommendation r) {
		super("Recommendation");
		texty = new JTextArea();
		miniBurger = new JSlider();
		texty.setLineWrap(true);
		texty.setText(r.getReason());
		miniBurger.setValue(r.getRating());
		init();
		texty.setEditable(false);
		miniBurger.setEnabled(false);
		pack();
	}

	private void init() {
		setPreferredSize(new Dimension(400,400));
		setLayout(new BorderLayout());
		btnConfirm = new JButton("Confirm");
		JScrollPane scrollPane = new JScrollPane();
		add(scrollPane, BorderLayout.CENTER);
		scrollPane.setViewportView(texty);
		add(btnConfirm, BorderLayout.SOUTH);
		miniBurger.setMajorTickSpacing(1);
		miniBurger.setMinorTickSpacing(0);
		miniBurger.setMaximum(5);
		miniBurger.setMinimum(1);
		miniBurger.setSnapToTicks(true);
		miniBurger.setPaintTicks(true);
		miniBurger.setPaintLabels(true);
		add(miniBurger, BorderLayout.NORTH);
		btnConfirm.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				dispose();
			}			
		});
	}
}
